package org.example.coupon.service;

import org.example.coupon.model.CouponRecordDO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.example.coupon.request.LockCouponRecordRequest;
import org.example.coupon.vo.CouponRecordVO;
import org.example.model.CouponRecordMessage;
import org.example.util.JsonData;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 林道敬
 * @since 2024-04-18
 */
public interface CouponRecordService extends IService<CouponRecordDO> {

    Map<String, Object> page(int page, int size);

    CouponRecordVO findById(long recordId);

    JsonData lockCouponRecords(LockCouponRecordRequest recordRequest);

    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    boolean releaseCouponRecord(CouponRecordMessage recordMessage);
}
